import apiClient from './client'
import type { LoginRequest, LoginResponse, RegisterRequest, User } from '@/types/user'

export const authAPI = {
  login: (data: LoginRequest): Promise<LoginResponse> => {
    return apiClient.post('/users/login', data)
  },

  register: (data: RegisterRequest): Promise<User> => {
    return apiClient.post('/users/register', data)
  },

  getCurrentUser: (): Promise<User> => {
    return apiClient.get('/users/me')
  },

  logout: (): Promise<void> => {
    return apiClient.post('/users/logout')
  }
}
